home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_13_04 / chapman / cfhmem.cpp < prev    next >
Text File  |  1994-03-01  |  787b  |  30 lines

  1. Listing 5.
  2.  
  3. counting_failure_handler::
  4.         counting_failure_handler(void)
  5. {
  6.     /* install ourselves as the current handler */
  7.     /* when we are created. */
  8.  
  9.     error_logged = warn_logged = 0L;
  10.     prev_handler = err_mgr.define_handler(this);
  11. }
  12.  
  13. counting_failure_handler::
  14.         ~counting_failure_handler(void)
  15. {
  16.     /* unlink ourselves from the handler chain */
  17.     /* when we are destroyed. */
  18.  
  19.     failure_handler *top = err_mgr.restore_handler();
  20.     /* no other handler should be stacked over us! */
  21.     ASSERT(top == this);
  22. }
  23.  
  24. void counting_failure_handler::error(const char *fmt,
  25.                                      va_list ap)
  26. {
  27.     ++error_logged;              /* tally problems */
  28.     prev_handler->error(fmt,ap); /* pass message on */
  29. }
  30.